An electronic device (e.g., a mobile phone) may be locked using a password. When the electronic device is locked, the user wants the password that is not easy to break, to keep the electronic device is in a safe state to avoid information leakage.